package Preson;

import BookListPackage.BookList;
import FunctionPackage.*;

import java.util.Scanner;

public class User extends Person {
    Function[] functions = new Function[] { new Exit(),
                                            new Search(),
                                            new Borrowing(),
                                            new Repaid(),
                                            new Display()};
    public User(String name) {
        super(name);
    }

    @Override
    public int mun() {
        System.out.println("-------欢迎来到图书---------");
        System.out.println("-------1.查找图书 ----------");
        System.out.println("-------2.借阅图书 ----------");
        System.out.println("-------3.归还图书 ----------");
        System.out.println("-------4.显示图书 ----------");
        System.out.println("-------0.退出系统 ----------");
        System.out.println("请输入你的操作：");
        Scanner scanner = new Scanner(System.in);
        return scanner.nextInt();

    }

    @Override
    public void operate(int choice, BookList bookList) {
        functions[choice].work(bookList);
    }
}
